<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
    <title>商家信息</title>
    <jsp:include page="../../include/header.jsp"></jsp:include>
     <style type="text/css">
			table td{
			text-align: center;
			}
		 	table th{
			text-align: center;
		 	}
		</style>
</head>

<body>
 
<div id="wrapper">

		<div style="width: 100%;height: 10%;text-align: center;">			
				<h1 class="page-header">商家信息</h1>		
		</div>
	<form id="addForm" action="${BASE_PATH}/dict/seller/doAdd" method="post" class="form-horizontal" enctype="multipart/form-data">
		<div class="form-group">
		    <label class="col-sm-3 control-label">商家ID</label>
		    <div class="col-sm-6">
	        	<input type="text" name="sellerid" value="${sellerid}" class="form-control" placeholder="" required maxlength="20" readonly="true">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">商家名称</label>
		    <div class="col-sm-6">
	        	<input type="text" name="sellerName" value="" class="form-control" placeholder="工商注册营业执照登记的全称" required maxlength="20">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">商家简称</label>
		    <div class="col-sm-6">
	        	<input type="text" name="shortName" value="" class="form-control" placeholder="请输入您的商家简称" required maxlength="20">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">法人</label>
		    <div class="col-sm-6">
	        	<input type="text" name="legalPerson" value="" class="form-control" placeholder="法人姓名" required maxlength="20">
	        	<div class="col-sm-9"><span style="margin-right:10px; color:red;">***</span><span class="text-success">联系人手机号默认为H5前端登录账号，默认密码为手机号后6位</span></div>
		    </div>
		    
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">联系人手机号</label>
		    <div class="col-sm-6">
	        	<input type="tel" id="contact" name="contact" value="" class="form-control" placeholder="请输入法人联系方式或企业实际控制人联系方式" required maxlength="11">
		    
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">营业执照号</label>
		    <div class="col-sm-6">
	        	<input type="text" id="" name="busLicense" value="" class="form-control" placeholder="营业执照注册号/社会统一信用代码" required maxlength="50">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-3 control-label">成立时间</label>
		    <div class="col-sm-6">
	        	<input type="text" name="settime" value="" class="form-control" placeholder="请输入成立时间(注意格式：2014-09-12)" required maxlength="20">
		    </div>
		</div>
		<div style="width: 60%;margin: auto;">
		  <div style="width:30%;float: left; margin-left: 10%;">
		  <input type="file" id="thumb" name="busthumb" style="width: 100%;" accept="image/jpg,image/png" title="营业执照副本照片" required>
		   <footer>营业执照副本照片</footer>
		  </div>
		  <div style="width:30%;float: right;margin-right: 10%;">
		  
		  <input type="file" id="thum" name="perthumb" style="width: 100%;" accept="image/jpg,image/png" title="法人身份证照片" required>
		  <footer>法人身份证照片</footer>
		  </div>
		</div>
		
		<div class="row" style="margin-top: 80px;">
			<div class="col-lg-8"><button class="btn btn-primary col-sm-5 pull-right" type="submit" autocomplete="off">提交</button></div>	
		</div>
	</form>		
 
	</div>

<jsp:include page="../../include/javascripts.jsp"></jsp:include>
<script type="text/javascript">


$(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules:{			
			contact: {isTelOrMobile: true},
			aphone: {isTelOrMobile: true},
		
		},
		messages:{				
			sellerName:{required: "工商注册营业执照登记的全称"}, 
			shortName:{required: "请输入您的商家简称"}, 
			legalPerson:{required: "法人姓名"}, 
			contact:{required: "请输入法人联系方式或企业实际控制人手机号"},
			busLicense:{required: "营业执照注册号/社会统一信用代码"}, 
			settime:{required: "请输入成立时间(注意格式：2014-09-12)"}, 
			busthumb:{required: "请添加营业执照副本照片"}, 
			perthumb:{required: "请添加法人身份证照片"}
		
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					    case 1:
						Kit.alert("该商家已经存在，请重新入驻");return;
						case 2:
							Kit.alert("请输入座机或手机号码");return;
						case 3:
							Kit.alert("请输入正确的日期格式");return;
						case 4:
							Kit.alert("请添加营业执照照片");return;
						case 5:
							Kit.alert("请添加法人身份证照片");return;
						case 6:
							Kit.alert("该手机号已注册，请更换手机号");return;
						case -1:
							Kit.alert("网络繁忙...，请重新登录");return;
						case 0:
                             window.location.reload();					
							return;
					}
				}
			});
		}
	});
});

</script> 
</body>	  		
</html>